package com.example.find_module.find.fragments.attention;

import com.example.common.entity.BaseEntity;
import com.example.common.mvvm.model.BaseRespository;
import com.example.find_module.find.fragments.attention.entity.FindEntity;

import io.reactivex.Observable;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class AttentionModel extends BaseRespository {

    //获取发现列表
    Observable<BaseEntity> requestAttention(){
        Retrofit retrofit=new Retrofit.Builder()
                .client(new OkHttpClient.Builder()
                        .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
                        .build())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://118.195.161.134:8088/")
                .build();
        Observable<FindEntity> findEntityObservable = retrofit.create(ApiService.class).requestFind();
        return checkNetWork(findEntityObservable);
    }

}
